package com.oneonefive.educationsystem.vo;

import com.oneonefive.educationsystem.domain.Arrange;
import com.oneonefive.educationsystem.domain.StudentRequest;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.util.Comparator;

@Data
@ToString
@AllArgsConstructor
public class ArrangeVo extends Arrange implements Comparator<Arrange> {
    private String[] strings = new String[6];

    private String  weekdayString;

    private StudentRequest studentRequest;

    private boolean state;

    public ArrangeVo() {
        this.setLabId("");
    }
    // ORDER BY weekday,lab.lab_type,lab.lab_id
    @Override
    public int compare(Arrange o1, Arrange o2) {
        int result = o1.getWeekday() - o2.getWeekday();
        if (result != 0) {
            return result;
        }
        result=o1.getLab().getLabType() - o2.getLab().getLabType();
        if (result != 0) {
            return result;
        }

        result = o1.getLab().getLabName().compareTo(o2.getLab().getLabName());
        if (result != 0) {
            return result;
        }
        return o1.getLabId().compareTo(o2.getLabId());
    }
}
